Hi, I'm trying to create a layout DXL column which searches the child links for an attribute value which matches the parent identifier. I am running this from the parent module. Right now my code looks like:
Object o
Link lnk
for o in entire current Module do {
// Outlinks can be iterated, since the source is already loaded
for lnk in all o -> "*" do {
string reqID = identifier o
// load target
ModuleVersion mvTarget = targetVersion lnk
Module modTarget = data mvTarget
if (null modTarget) modTarget = load(mvTarget, false)
if (null modTarget) { /* error handling */; continue }
// get target object
Object Tgt = target lnk
if (null Tgt) { /* error handling */; continue }
if (isDeleted Tgt) { /* error handling */; continue }
string VAMID = identifier Tgt
string unverified = Tgt."UnverifiedReqs"
Regexp re = regexp reqID "\n"
if (search(re,unverified,0)) {
displayRich("\\pard " VAMID)
}
else {
displayRich("\\pard " "")
}
print "Out: '" (Tgt."Object Text") "'\n"
}
}
I have the print at the end just to monitor that the output is running correctly. When I go to run the code I get the following error message:
-E- DXL: <Line:23> incorrect arguments for function (search)
The DXL reference on the search function is pretty spartan and I just don't know why it won't run. Another problem I have is that the printed output, if I remove the search function, runs much more than once. My intention is for the script to look at an object, search each child, and then move to the next object. My practice modules have 4 requirements in a requirements module and 5 child links in another module. The total number of links is 8. The output at the end print "Out: '" (Tgt."Object Text") "'\n" spits out the information in the correct order, but it loops 12 times. Is there any way to make the script iterate just once?
Thanks for any help. geemo - Wed May 03 16:21:43 EDT 2017 |